package com.shang;

import com.shang.auto.Emp;
import com.shang.bean.Phone;
//import com.shang.bean.Stu;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @ClassName TestCollection
 * @Description TODO
 * @Author Larry
 * @Date 2021/5/19 18:02
 * @Version 1.0
 */
public class TestCollection {

//    @Test
//    public void test1(){
//
//        ApplicationContext ctx = new ClassPathXmlApplicationContext("bean1.xml");
//        Stu stu = ctx.getBean("stu", Stu.class);
//        stu.teststu();
//
//    }

    @Test
    public void test2(){

        ApplicationContext ctx = new ClassPathXmlApplicationContext("bean2.xml");
        Phone phone = ctx.getBean("phone", Phone.class);
        System.out.println("创建实例对象。。。。。。。。。。。。");
        System.out.println(phone);
        phone.testphone();

        ((ClassPathXmlApplicationContext)ctx).close();

    }

    @Test
    public void test3(){

        ApplicationContext ctx = new ClassPathXmlApplicationContext("bean3.xml");
        Emp emp = ctx.getBean("emp", Emp.class);
        System.out.println(emp);

    }
}
